<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Moshi Player ver 1.0</title>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<style>
.box{
	width:100%;
	float:left;
}
</style>
<script type="text/javascript">
	var videoId = $.urlParam('id');
	
	function getVideoPlayer(videoId){
		if(videoId==undefined || videoId==0){
			alert("videoId is empty");
		}else{

			$("#videoPlayer").text("You need Flash player 8+ and JavaScript enabled to view this video.");
			
			var params = { allowScriptAccess: "always" };
			var atts = { id: "myytplayer" };
			swfobject.embedSWF("http://www.youtube.com/v/"+videoId+"?enablejsapi=1&playerapiid=ytplayer&version=3",
							   "videoPlayer", "425", "356", "8", null, null, params, atts);
			getVideoInfo(videoId);				   
		}		   
	}
	
	function getVideoInfo(videoId) {
		if(videoId==undefined || videoId==0){
			alert("videoId is empty");
		}else{
			$.getJSON("http://gdata.youtube.com/feeds/api/videos/"+videoId+"?v=2&alt=jsonc", 
			function(data){ showVideoInfo(data); });
		}
	}
	
	function showVideoInfo(videoInfo){
		$("#videoTitle").html(videoInfo.data.title);
		$("#videoDesc").html(videoInfo.data.description);
		$("#videoViews").html(videoInfo.data.viewCount);
		$("#videoDuration").html(videoInfo.data.uploaded);
		$("#videoDate").html(videoInfo.data.duration);
	}
	
	$(document).ready(function () {
        getVideoPlayer(videoId);
    });
			
</script>
</head>

<body>
<div id="videoPlayer" class="box"></div>
<div id="videoTitle" class="box"></div>
<div id="videoDesc" class="box"></div>
<div id="videoViews" class="box"></div>
<div id="videoDuration" class="box"></div>
<div id="videoDate" class="box"></div>
</body>
</html>
